package com.group3.hospital.mapper;

import com.group3.hospital.bean.HealthKnows;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * @author 尚硅谷
 * @create 2021/12/31
 */
public interface HealthMapper {

    @Select("select * from health order by health_id desc limit 6")
    List<HealthKnows> queryAll();

    @Select("select count(1) from health")
    Integer queryCount();

    @Select("select * from health order by health_id desc limit #{page},6")
    List<HealthKnows> queryByPage(Integer page);

    @Delete("delete from health where health_id = #{id}")
    void deleteById(Integer id);

    @Select("select * from health where health_id = #{id}")
    HealthKnows selectByHealthId(Integer id);


    @Insert("insert into health values(default,#{healthImg},#{healthTitle},#{healthDate},#{healthBody},null,null,null)")
    void addHealthKnow(HealthKnows healthKnows);
}
